var ClubReturnRoomUnit = Unit.extend({
    _ccsFileName: res.ClubReturnRoomUnit_json,
    _roomInfo: null,
    initUnit: function (temp, roomInfo) {
        this._roomInfo = roomInfo;
    },
    /**
     * View基类初始化
     */
    initView: function () {
        this._actionType = ViewActionType.None;
        if (this._actionType === ViewActionType.None) {
            this._rootNode.show();
        }
        this._loadCCSFinished = true;
        this.setData.apply(this, arguments);
    },
    onEnter: function () {
        Unit.prototype.onEnter.call(this);
        this._initAllListeners();
    },

    _initClickListeners: function () {
        this._clickListeners = {
            //'bg1': '_clickBg',
            'grade': '_clickReturnRoom',
            'remove': '_clickRemoveRoom',
            'touchLayer': '_clickTouchLayer',
        }
    },


    _clickReturnRoom: function () {
        eventManager.dispatchEvent(ClubEvent.ClubTableWindowClose);
        this.setVisible(false);
    },

    _clickRemoveRoom: function () {
        if (!this._roomInfo || !this._roomInfo['roomInfo']) {
            return;
        }
        // var mapId = this._roomInfo['roomInfo']['map_id'];
        // var status = this._roomInfo['roomInfo']['status'];
        var room_id = this._roomInfo['roomInfo']['room_id'];
        network.send(3019, {
            daikai_room_id: room_id,
            room_id: room_id,
            force: true,
            uid: gameData.uid,
        });
        this.setVisible(false);
        // if (mapId && mapId < 300) {
        //     if (status == 1) {
        //         network.send(3003, {
        //             daikai_room_id: room_id,
        //             room_id: room_id,
        //             force: true,
        //             uid: gameData.uid,
        //         });
        //     } else if (status == 2) {
        //         network.send(3019, {
        //             daikai_room_id: room_id,
        //             room_id: room_id,
        //             force: true,
        //             uid: gameData.uid,
        //         });
        //     }
        // } else {
        //     network.send(3003, {
        //         daikai_room_id: room_id,
        //         room_id: room_id,
        //         force: true,
        //         uid: gameData.uid,
        //     });
        // }
    },

    _clickTouchLayer: function () {
        this.setVisible(false);
    },

});